/*
 * @Author: zhouwei wei.zhou@flip.fun
 * @Date: 2024-04-26 15:28:16
 * @LastEditors: zhouwei wei.zhou@flip.fun
 * @LastEditTime: 2024-04-27 15:47:05
 * @FilePath: /redux/src/App.jsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import { useDispatch, useSelector } from './redux/react-redux'
import './App.css'

function App() {
	const [count, setCount] = useState(1)
	const dispatch = useDispatch()
	const num = useSelector(store => store.store.num)
	console.log(num)
	return (
		<>
			<div>
				<a
					href='https://vitejs.dev'
					target='_blank'
				>
					<img
						src={viteLogo}
						className='logo'
						alt='Vite logo'
					/>
				</a>
				<a
					href='https://react.dev'
					target='_blank'
				>
					<img
						src={reactLogo}
						className='logo react'
						alt='React logo'
					/>
				</a>
			</div>
			<h1>Vite + React</h1>
			<div className='card'>
				<button onClick={() => dispatch({ type: 'add', payload: count })}>count is {num}</button>
				<p>
					Edit <code>src/App.jsx</code> and save to test HMR
				</p>
			</div>
			<p className='read-the-docs'>Click on the Vite and React logos to learn more</p>
		</>
	)
}

export default App
